package cn.gson.oasys.controller;

import cn.gson.oasys.pojo.AoaDept;
import cn.gson.oasys.service.AoaDeptService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author wjn
 * @Date 2020/11/26 - 10:39.
 */
@Controller
public class AoaDeptController {
    @Resource
    private AoaDeptService aoaDeptService;

    @RequestMapping("getAllAoaDept")
    @ResponseBody
    //用户管理-》部门管理-》查询（名称、电话、邮箱、地址）-WJN
    public Object getAllAoaDepts(){
        List<AoaDept> aoaDeptList =  aoaDeptService.getAllAoaDept();
        return aoaDeptList;
    }
    @RequestMapping("addAoaDept")
    @ResponseBody
    //用户管理-》部门管理-》添加（名称、电话、邮箱、地址）-WJN
    public Object addAoaDepts(AoaDept aoaDept){
        int i = aoaDeptService.addAoaDept(aoaDept);
        return i;
    }

    @RequestMapping("updateAoaDate")
    @ResponseBody
    //用户管理-》部门管理-》修改（名称、电话、邮箱、地址）-WJN
    public Object updateAoaDate(AoaDept aoaDept){
        int i = aoaDeptService.updateAoaDate(aoaDept);
        return i;
    }

    @RequestMapping("deleteAoaDept")
    @ResponseBody
    //用户管理-》部门管理-》删除（根据部门ID删除部门）-WJN
    public Object deleteAoaDeptById(Integer deptId){
        int i = aoaDeptService.deleteAoaDept(deptId);
        return i;
    }

}
